#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

typedef struct Context_s{
	int n;
	char a[210];
	char b[210];
	char c[1000];
	int La;
	int Lb;
	int Lc;
}Context;
char valid[210][210][410];
Context ctx;

void read_data(Context* ctx)
{
	cin >> ctx->n;
}

void read_data2(Context* ctx)
{
	cin >> ctx->a;
	cin >> ctx->b;
	cin >> ctx->c;
	ctx->La = strlen(ctx->a);
	ctx->Lb = strlen(ctx->b);
	ctx->Lc = strlen(ctx->c);
}
bool Valid(Context* ctx, int as,int bs,int cs)
{	
	if( cs == ctx->Lc  ) {
		if( as == ctx->La && bs == ctx->Lb)
			return true;
		else
			return false;
	}
	if( valid[as][bs][cs] != -1 )
		return valid[as][bs][cs];
	bool b1 = false,b2 = false;
	if( ctx->a[as] == ctx->c[cs])
		b1 = Valid(ctx, as+1,bs,cs+1);
	if( ctx->b[bs] == ctx->c[cs])
		b2 = Valid(ctx, as,bs+1,cs+1);
	valid[as][bs][cs] = b1 || b2;
	return b1 || b2;
	
}
bool judge(Context* ctx)
{
	for(int cs = 0; cs <= ctx->Lc; ++cs)
		for(int as = 0; as <= ctx->La; ++ as) {
			int bs = cs - as; 
			valid[as][bs][cs] = -1;
		}
	return Valid(ctx, 0,0,0);
}

void solve(Context* ctx)
{
	for(int i=1;i<=ctx->n;++i)
	{
		read_data2(ctx);
		cout << "Data set " << i << ": ";
		if (judge(ctx))
			cout << "yes";
		else
			cout << "no";
		cout << endl;
	}
}

int main()
{
	freopen("week06_t02.txt","r",stdin);
	read_data(&ctx);
	solve(&ctx);
	return 0;
}
